<div class="news index">
	<h2><?php __('Danh sách tin tức');?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
		<th scope="col" id="cb" class="check-column" ><input type="checkbox"></th>
		<th class="th_img_index"><?php echo $this->Paginator->sort('image');?></th>
		<th class="th_name_index"><?php 
			echo $this->Paginator->sort('name');
			//echo $this->Paginator->sort('category_id');?></th>
		<th class="th_status_index"><?php echo $this->Paginator->sort('status');?></th>
		<th class="th_user_index"><?php echo $this->Paginator->sort('user_id');?></th>
		<th class="th_created_index"><?php echo $this->Paginator->sort('created');?></th>
			<th class="actions th_action_index"><?php __('Actions');?></th>
	</tr>
	<?php
	$i = 0;
	$k=0;
	foreach ($news as $news1):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<th scope="row" class="check-column">
		<?php 
			echo $this->Form->checkbox('dataNews]['.$k.'][id', array('value' => $news1['News']['id']), array('align'=>'center'));
		?>
		</th>
		<td><?php
			$link_img = '';
			if($news1['News']['image'])
				$link_img = '<img class="img_index" src="'.$this->webroot.$news1['News']['image'].'"/>';
			else
				$link_img = '<img class="img_index" src="'.$this->webroot.'img/img_not_found_100x60.jpg"/>';
				echo $link_img;
		?>&nbsp;</td>

		<td>
			<div class="content_title">
				<h4 class="title_index"><?php echo $this->Html->link($news1['News']['name'], array('controller' => 'news', 'action' => 'view', $news1['News']['id'])); ?></h4>&nbsp;
				<div class="cat_index">
					Chuyên mục :&nbsp;<?php echo $this->Html->link($news1['Category']['name'], array('controller' => 'categories', 'action' => 'view', $news1['Category']['id'])); ?>
				</div>
			</div>
		</td>
		
		<td><?php 
			//echo $news1['News']['status'];	
			if ($news1['News']['status'] == 1){
				echo $this->Html->link(__('', true), array('controller'=>'news','action' => 'unactive', $news1['News']['id']), array('class'=>'active','label'=>'','title'=>'Trạng thái được kích hoạt'), sprintf(__('Bạn chắc muốn hủy kích hoạt %s?', true), $news1['News']['name']));
			}
			else
				echo $this->Html->link(__('', true), array('controller'=>'news','action' => 'active', $news1['News']['id']), array('class'=>'unactive','label'=>'','title'=>'Trạng thái hủy kích hoạt'), sprintf(__('Bạn chắc muốn kích hoạt %s?', true), $news1['News']['name']));

		?>&nbsp;</td>
		<td>
			<?php echo $this->Html->link($news1['User']['name'], array('controller' => 'users', 'action' => 'view', $news1['User']['id'])); ?>
		</td>
		<td><?php //echo $news1['News']['created']; ?>
			<abbr title="<?php echo date("d-m-Y H:i:s",strtotime($news1['News']['created'])); ?>"><?php echo date("d-m-Y H:i:s",strtotime($news1['News']['created'])); ?>&nbsp;</abbr>
		&nbsp;</td>
		<td class="actions">
			<?php echo $this->Html->link(__('View', true), array('action' => 'show', $news1['News']['id']),array('target'=>'_blank')); ?>
			<?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $news1['News']['id'])); ?>
			<?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $news1['News']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $news1['News']['name'])); ?>
		</td>
	</tr>
	<?php $k++;	endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>

